//
//  SWCell.h
//  White Detector Grid
//
//  Created by David Langford on 9/05/09.
//  Copyright 2009 Sentient Worlds. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#include <Accelerate/Accelerate.h>

@interface SWCell : NSObject {
	int						xInPixels;
	int						yInPixels;
	int						widthInPixels;
	int						heightInPixels;
	double					weight;
	
	vImagePixelCount				_histogramA[256];
	vImagePixelCount				_histogramR[256];
	vImagePixelCount				_histogramG[256];
	vImagePixelCount				_histogramB[256];
}

@property (assign) int xInPixels;
@property (assign) int yInPixels;
@property (assign) int widthInPixels;
@property (assign) int heightInPixels;
@property (assign) double weight;

- (id) initWithXPositionAt:(int)startXposition
			   yPositionAt:(int)startYposition
			 widthInPixels:(int)startWidth
			heightInPixels:(int)startHeight;

- (BOOL) generateWeightFromImage:(id<QCPlugInInputImageSource>)imageToUse
					   inContext:(id<QCPlugInContext>)theContext;

- (double) generateWeightFromHistogram:(vImagePixelCount**)histograms
							usingChannel:(int)channel;

- (NSArray*) asNSArrayWithDestinationWidthInPixels:(double)destinatinoWidthInPixels
					 destinationAreaHeightInPixels:(double)destinationHeightInPixels
						   destinationWidthInUnits: (double)destinationWidthInUnits
						  destinationHeightInUnits: (double)destinationHeightInUnits
								destinationXOffset: (double)destinationXOffsetInUnits
								destinationYOffset: (double)destinationYOffsetInUnits;

@end
